package braindamagestudio.com.app.fight;

import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.options.EngineOptions;
import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.scene.background.ColorBackground;
import org.anddev.andengine.entity.util.FPSLogger;
import org.anddev.andengine.opengl.buffer.BufferObjectManager;
import org.anddev.andengine.ui.activity.BaseGameActivity;


import android.app.Activity;
import android.content.Intent;
import android.util.Log;

public class Launcher extends BaseGameActivity {
	
    private static final int CAMERA_WIDTH = 480;
	private static final int CAMERA_HEIGHT = 800;
	private Camera mCamera;
	
	public void StartActivitySetting()
	{
		BufferObjectManager.getActiveInstance().clear();
		this.finish();
		this.startActivity(new Intent(this,AppFightActivity.class));		
	}
	
	static void StartActivity(Activity activity,Class<?> next)
	{
		BufferObjectManager.getActiveInstance().clear();
		activity.finish();
		activity.startActivity(new Intent(activity,next));
	}	

	@Override
	public Engine onLoadEngine() {
		Log.d("gameloop", "onLoadEngine");		
		this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
		return new Engine(new EngineOptions(true, ScreenOrientation.PORTRAIT, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera));
	}

	@Override
	public void onLoadResources() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Scene onLoadScene() {
		this.mEngine.registerUpdateHandler(new FPSLogger());

		final Scene scene = new Scene();
		scene.setBackground(new ColorBackground(0.09804f, 0.6274f, 0.8784f));
		return scene;
	}

	@Override
	public void onLoadComplete() {
		StartActivitySetting();
	}
	
	
}